package com.zhifa.graph;

import lombok.Data;

import java.util.Objects;
/**
 * @version V1.0
 * @Copyright - Powered By 基础软件开发部
 * @author: liangzhifa
 * @date: 2022/4/24 16:08
 * @Description: 边
 */
@Data
public class Edge<V> {
    private V fromNode;
    private V toNode;
    //todo:其他参数属性

    public Edge(V fromNode, V toNode) {
        if (Objects.equals(fromNode, toNode)) {//节点不能自身指向自身
            throw new RuntimeException("节点不能自身指向自身");
        }
        this.fromNode = fromNode;
        this.toNode = toNode;
    }
}
